import React from "react";
import { connect } from 'react-redux';
import {fromJS} from 'immutable';
import Header from '../components/header';
import CreatList from '../components/creatList';
import { ScollListRow0ul } from '../style';
import SearchListItem from '../components/scollListRow2';
import { actionCreators } from '../store';
class SearchBarExample extends React.Component {
    render() {
        let { collectNoverByIdList } = this.props;
        // collectNoverByIdList=[1,23,4]
        return (<div>
            <Header {...this.props} />
            <div className="content pfooter">
                <ScollListRow0ul>
                    <CreatList data={collectNoverByIdList} CreatItem={SearchListItem} {...this.props} />
                </ScollListRow0ul>
            </div>
        </div>);
    }
    componentDidMount() {
        let { collectNoverById,collectNoverByIdList, getcollectNoverByIdList } = this.props;
         if (collectNoverByIdList.length!==collectNoverById.length) {
            getcollectNoverByIdList(collectNoverById)
        }       
    }
}
const mapStateToProps = (state, ownProps) => {
    state= fromJS(state);
    return {
        collectNoverById: state.getIn(["novel", "collectNoverById"]).toJS(),
        collectNoverByIdList: state.getIn(["novel", "collectNoverByIdList"]).toJS(),
    };
};
const mapDispatchToProps = (dispatch, ownProps) => {
    return {
        getcollectNoverByIdList(cBId) {
            dispatch(actionCreators._getcollectNoverByIdList(cBId))
        },
        _collectNoverByIdDe(val) {
            dispatch(actionCreators.collectNoverByIdDe(val))
        }
    };
};
export default connect(mapStateToProps, mapDispatchToProps)(SearchBarExample);
